package models

import (
	"fmt"
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

type Video struct {
	gorm.Model
	Title  string `json:"title"`
	Intro  string `json:"intro"`
	Img    string `json:"img"`
	Timed  string `json:"timed"`
	People string `json:"people"`
}

var DB *gorm.DB

func init() {
	dsn := "root:root@tcp(127.0.0.1)/day08"
	var err error
	DB, err = gorm.Open(mysql.Open(dsn))
	if err != nil {
		fmt.Println("数据库连接失败")
	} else {
		fmt.Println("数据库连接成功")
	}
}
